package com.example.heimaplayer.ui.fragment

import android.annotation.SuppressLint
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.appcompat.widget.ToolbarWidgetWrapper
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.PreferenceScreen
import com.example.heimaplayer.R
import com.example.heimaplayer.ui.activity.AboutActivity
import com.example.heimaplayer.ui.activity.MainActivity
import com.example.heimaplayer.ui.activity.SettingsActivity
import com.example.heimaplayer.util.ToolBarManager
import kotlinx.android.synthetic.main.toolbar.*
import org.jetbrains.anko.support.v4.toast

class SettingsFragment : PreferenceFragmentCompat() {
    @SuppressLint("ResourceType")
    override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
        setPreferencesFromResource(R.xml.root_preferences,rootKey)
    }


    override fun onPreferenceTreeClick(preference: Preference?): Boolean {
        val key = preference?.key
        toast("哈哈")
        if ("about".equals(key)){
            startActivity(Intent(activity,AboutActivity::class.java))
        }
        return super.onPreferenceTreeClick(preference)
    }

}